//package dataTransfer;
//
//import org.apache.kafka.clients.producer.KafkaProducer;
//import org.apache.kafka.clients.producer.Producer;
//import org.apache.kafka.clients.producer.ProducerRecord;
//
//import java.io.BufferedReader;
//import java.io.File;
//import java.io.FileReader;
//import java.io.IOException;
//import java.util.Properties;
//
//public class dataTokafka {
//
//    /**
//     * �����ı����ݵ�kafka
//     * @param args
//     * @throws IOException
//     */
//    public static void main(String[] args) throws IOException {
//        Properties props = new Properties();
//        props.put("bootstrap.servers", "node01:9092,node02:9092,node03:9092");
//        props.put("acks", "-1");
//        props.put("retries", 0);
//        props.put("batch.size", 16384);
//        props.put("linger.ms", 1);
//        props.put("buffer.memory", 33554432);
//        props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
//        props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
//        Producer<String, String> producer = new KafkaProducer<>(props);
//        File inputFile = new File("E:\\����ѧ����Ƶ�ʼ�\\��ҵ\\4.14����ϰ��\\4.14����ϰ��\\aaa.txt");
//        BufferedReader bufferedReader = new BufferedReader(new FileReader(inputFile));
//        String line = null;
//        int partition = 0;
//        while ((line = bufferedReader.readLine()) != null) {
//            try {
//                if (Integer.parseInt(line.split("\t")[0]) % 2 == 0) {
//                    partition = 0;
//                } else {
//                    partition = 1;
//                }
//            } catch (NumberFormatException e) {
//                continue;
//            }
//            producer.send(new ProducerRecord<String, String>("rng_comment1", partition, String.valueOf(partition), line));
//        }
//        bufferedReader.close();
//        producer.close();
//    }
//}
